home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / Windows / Interfaces / QD3DStorage.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-03  |  7.7 KB  |  260 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DStorage.h                                             **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Abstraction to deal with various types of stream-based     **
  7.  **                    storage devices.                                         **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **                                                                          **
  11.  **     Copyright (C) 1992-1996 Apple Computer, Inc.  All rights reserved.     **
  12.  **                                                                          **
  13.  **                                                                          **
  14.  *****************************************************************************/
  15. #ifndef QD3DStorage_h
  16. #define QD3DStorage_h
  17.  
  18. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  19. #include <Types.h>
  20. #include <Files.h>
  21. #endif  /*  OS_MACINTOSH  */
  22.  
  23. #if defined(OS_WIN32) && OS_WIN32
  24. #include <windows.h>
  25. #endif /* OS_WIN32 */
  26.  
  27. #if defined(THINK_C) || defined(__SC__)
  28.     #pragma options(!pack_enums, !align_arrays)
  29.     #pragma SC options align=power
  30. #elif defined(__MWERKS__)
  31.     #pragma enumsalwaysint on
  32.     #pragma align_array_members off
  33.     #pragma options align=native
  34. #elif defined(__PPCC__)
  35.     #pragma options align=power
  36. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  37.     #pragma options enum=int
  38. #endif
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif    /* __cplusplus */
  43.  
  44. /******************************************************************************
  45.  **                                                                             **
  46.  **                                Storage Routines                             **
  47.  **                                                                             **
  48.  *****************************************************************************/
  49.  
  50. QD3D_EXPORT TQ3ObjectType Q3Storage_GetType(
  51.     TQ3StorageObject    storage);
  52.  
  53. QD3D_EXPORT TQ3Status Q3Storage_GetSize(
  54.     TQ3StorageObject    storage,
  55.     unsigned long        *size);
  56.  
  57. /* 
  58.  *    Reads "dataSize" bytes starting at offset in storage, copying into data. 
  59.  *    sizeRead returns the number of bytes filled in. 
  60.  *    
  61.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeRead
  62.  */
  63.  
  64. QD3D_EXPORT TQ3Status Q3Storage_GetData(
  65.     TQ3StorageObject    storage,
  66.     unsigned long        offset,
  67.     unsigned long        dataSize,
  68.     unsigned char        *data,
  69.     unsigned long        *sizeRead);
  70.  
  71. /* 
  72.  *    Write "dataSize" bytes starting at offset in storage, copying from data. 
  73.  *    sizeWritten returns the number of bytes filled in. 
  74.  *    
  75.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeWritten
  76.  */
  77.  
  78. QD3D_EXPORT TQ3Status Q3Storage_SetData(
  79.     TQ3StorageObject    storage,
  80.     unsigned long        offset,
  81.     unsigned long        dataSize,
  82.     const unsigned char    *data,
  83.     unsigned long        *sizeWritten);
  84.  
  85. /******************************************************************************
  86.  **                                                                             **
  87.  **                             Memory Storage Prototypes                         **
  88.  **                                                                             **
  89.  *****************************************************************************/
  90.  
  91. QD3D_EXPORT TQ3ObjectType Q3MemoryStorage_GetType(
  92.     TQ3StorageObject        storage);
  93.  
  94. /*
  95.  * These calls COPY the buffer into QD3D space
  96.  */
  97. QD3D_EXPORT TQ3StorageObject Q3MemoryStorage_New(
  98.     const unsigned char        *buffer,
  99.     unsigned long            validSize);
  100.  
  101. QD3D_EXPORT TQ3Status Q3MemoryStorage_Set(
  102.      TQ3StorageObject        storage,
  103.     const unsigned char        *buffer,
  104.     unsigned long            validSize);
  105.  
  106. /*
  107.  * These calls use the pointer given - you must dispose it when you're through
  108.  */
  109. QD3D_EXPORT TQ3StorageObject Q3MemoryStorage_NewBuffer(
  110.     unsigned char            *buffer,
  111.     unsigned long            validSize,
  112.     unsigned long            bufferSize);
  113.  
  114. QD3D_EXPORT TQ3Status Q3MemoryStorage_SetBuffer(
  115.      TQ3StorageObject        storage,
  116.     unsigned char            *buffer,
  117.     unsigned long            validSize,
  118.     unsigned long            bufferSize);
  119.  
  120. QD3D_EXPORT TQ3Status Q3MemoryStorage_GetBuffer(
  121.      TQ3StorageObject        storage,
  122.     unsigned char            **buffer,
  123.     unsigned long            *validSize,
  124.     unsigned long            *bufferSize);
  125.  
  126. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  127.  
  128. /******************************************************************************
  129.  **                                                                             **
  130.  **                                Macintosh Handles Prototypes                 **
  131.  **                                                                             **
  132.  *****************************************************************************/
  133.  
  134. /* Handle Storage is a subclass of Memory Storage */
  135.  
  136. QD3D_EXPORT TQ3StorageObject Q3HandleStorage_New(
  137.     Handle                    handle,
  138.     unsigned long            validSize);
  139.  
  140. QD3D_EXPORT TQ3Status Q3HandleStorage_Set(
  141.      TQ3StorageObject        storage,
  142.     Handle                    handle,
  143.     unsigned long            validSize);
  144.  
  145. QD3D_EXPORT TQ3Status Q3HandleStorage_Get(
  146.      TQ3StorageObject        storage,
  147.      Handle                    *handle,
  148.     unsigned long            *validSize);
  149.  
  150. /******************************************************************************
  151.  **                                                                             **
  152.  **                                Macintosh Storage Prototypes                 **
  153.  **                                                                             **
  154.  *****************************************************************************/
  155.  
  156. QD3D_EXPORT TQ3StorageObject Q3MacintoshStorage_New(                    
  157.     short                    fsRefNum);    /* Note: This storage is assumed open */
  158.  
  159. QD3D_EXPORT TQ3Status Q3MacintoshStorage_Set(
  160.      TQ3StorageObject        storage,
  161.     short                    fsRefNum);
  162.  
  163. QD3D_EXPORT TQ3Status Q3MacintoshStorage_Get(
  164.      TQ3StorageObject        storage,
  165.     short                    *fsRefNum);
  166.     
  167. QD3D_EXPORT TQ3ObjectType Q3MacintoshStorage_GetType(
  168.     TQ3StorageObject        storage);
  169.  
  170.  
  171. /******************************************************************************
  172.  **                                                                             **
  173.  **                            Macintosh FSSpec Storage Prototypes                 **
  174.  **                                                                             **
  175.  *****************************************************************************/
  176.  
  177. QD3D_EXPORT TQ3StorageObject Q3FSSpecStorage_New(
  178.     const FSSpec            *fs);
  179.  
  180. QD3D_EXPORT TQ3Status Q3FSSpecStorage_Set(
  181.      TQ3StorageObject        storage,
  182.     const FSSpec            *fs);
  183.  
  184. QD3D_EXPORT TQ3Status Q3FSSpecStorage_Get(
  185.      TQ3StorageObject        storage,
  186.     FSSpec                    *fs);
  187.  
  188. #endif  /*  OS_MACINTOSH  */
  189.  
  190. #if defined(OS_WIN32) && OS_WIN32
  191.  
  192. /******************************************************************************
  193.  **                                                                             **
  194.  **                            Win32 HANDLE Storage Prototypes                     **
  195.  **                                                                             **
  196.  *****************************************************************************/
  197.  
  198. QD3D_EXPORT TQ3StorageObject Q3Win32Storage_New(
  199.     const HANDLE            hFile);
  200.  
  201. QD3D_EXPORT TQ3Status Q3Win32Storage_Set(
  202.      TQ3StorageObject        storage,
  203.     const HANDLE            hFile);
  204.  
  205. QD3D_EXPORT TQ3Status Q3Win32Storage_Get(
  206.      TQ3StorageObject        storage,
  207.     const HANDLE            *hFile);
  208.  
  209. #endif  /*  OS_WIN32  */
  210.  
  211. /******************************************************************************
  212.  **                                                                             **
  213.  **                                    Unix Prototypes                             **
  214.  **                                                                             **
  215.  *****************************************************************************/
  216.  
  217. QD3D_EXPORT TQ3StorageObject Q3UnixStorage_New(
  218.     FILE                    *storage);
  219.  
  220. QD3D_EXPORT TQ3Status Q3UnixStorage_Set(
  221.      TQ3StorageObject        storage,
  222.     FILE                    *stdFile);
  223.  
  224. QD3D_EXPORT TQ3Status Q3UnixStorage_Get(
  225.      TQ3StorageObject        storage,
  226.     FILE                    **stdFile);
  227.     
  228. QD3D_EXPORT TQ3ObjectType Q3UnixStorage_GetType(
  229.     TQ3StorageObject        storage);
  230.  
  231.  
  232. /******************************************************************************
  233.  **                                                                             **
  234.  **                                Unix Path Prototypes                         **
  235.  **                                                                             **
  236.  *****************************************************************************/
  237.  
  238. QD3D_EXPORT TQ3StorageObject Q3UnixPathStorage_New(                    
  239.     const char                *pathName);                /* C string */
  240.  
  241. QD3D_EXPORT TQ3Status Q3UnixPathStorage_Set(            
  242.      TQ3StorageObject        storage,
  243.     const char                *pathName);                /* C string */
  244.  
  245. QD3D_EXPORT TQ3Status Q3UnixPathStorage_Get(            
  246.      TQ3StorageObject        storage,
  247.     char                    *pathName);                /* pathName is a buffer */
  248.  
  249. #ifdef __cplusplus
  250. }
  251. #endif    /* __cplusplus */
  252.  
  253. #if defined(__MWERKS__)
  254.     #pragma enumsalwaysint reset
  255. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  256.     #pragma options enum=reset
  257. #endif
  258.  
  259. #endif /* QD3DStorage_h */
  260.